# uncompyle6 version 3.2.3
# Python bytecode 3.6 (3379)
# Decompiled from: Python 3.6.8 |Anaconda custom (64-bit)| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)]
# Embedded file name: site-packages\jinja2\asyncfilters.py
from functools import wraps
from jinja2.asyncsupport import auto_aiter
from jinja2 import filters

async def auto_to_seq--- This code section failed: ---

   8       0  BUILD_LIST_0          0  ''
           2  STORE_FAST               'seq'

   9       4  LOAD_GLOBAL              'hasattr'
           6  LOAD_FAST                'value'
           8  LOAD_CONST               '__aiter__'
          10  CALL_FUNCTION_2       2  ''
          12  POP_JUMP_IF_FALSE    78  'to 78'

  10      14  SETUP_LOOP           76  'to 76'
          16  LOAD_FAST                'value'
          18  GET_AITER        
          20  LOAD_CONST               None
          22  YIELD_FROM       
          24  SETUP_EXCEPT         38  'to 38'
          26  GET_ANEXT        
          28  LOAD_CONST               None
          30  YIELD_FROM       
          32  STORE_FAST               'item'
          34  POP_BLOCK        
          36  JUMP_FORWARD         60  'to 60'
        38_0  COME_FROM_EXCEPT     24  '24'
          38  DUP_TOP          
          40  LOAD_GLOBAL              'StopAsyncIteration'
          42  COMPARE_OP               'exception-match'
          44  POP_JUMP_IF_FALSE    58  'to 58'
          46  POP_TOP          
          48  POP_TOP          
          50  POP_TOP          
          52  POP_EXCEPT       
          54  POP_BLOCK        
          56  JUMP_ABSOLUTE       102  'to 102'
          58  END_FINALLY      
        60_0  COME_FROM            36  '36'

  11      60  LOAD_FAST                'seq'
          62  LOAD_ATTR                'append'
          64  LOAD_FAST                'item'
          66  CALL_FUNCTION_1       1  ''
          68  POP_TOP          
          70  JUMP_BACK            24  'to 24'
          72  POP_BLOCK        
          74  JUMP_ABSOLUTE       102  'to 102'
        76_0  COME_FROM_LOOP       14  '14'
          76  JUMP_FORWARD        102  'to 102'
          78  ELSE                     '102'

  13      78  SETUP_LOOP          102  'to 102'
          80  LOAD_FAST                'value'
          82  GET_ITER         
          84  FOR_ITER            100  'to 100'
          86  STORE_FAST               'item'

  14      88  LOAD_FAST                'seq'
          90  LOAD_ATTR                'append'
          92  LOAD_FAST                'item'
          94  CALL_FUNCTION_1       1  ''
          96  POP_TOP          
          98  JUMP_BACK            84  'to 84'
         100  POP_BLOCK        
       102_0  COME_FROM_LOOP       78  '78'
       102_1  COME_FROM            76  '76'

  15     102  LOAD_FAST                'seq'
         104  RETURN_VALUE     
          -1  RETURN_LAST      

Parse error at or near `JUMP_ABSOLUTE' instruction at offset 74


def async_select_or_reject--- This code section failed: ---

  19       0  LOAD_GLOBAL              'filters'
           2  LOAD_ATTR                'prepare_select_or_reject'

  20       4  LOAD_FAST                'args'
           6  LOAD_FAST                'kwargs'
           8  LOAD_FAST                'modfunc'
          10  LOAD_FAST                'lookup_attr'
          12  CALL_FUNCTION_4       4  ''
          14  UNPACK_SEQUENCE_2     2  ''
          16  STORE_FAST               'seq'
          18  STORE_FAST               'func'

  21      20  LOAD_FAST                'seq'
          22  POP_JUMP_IF_FALSE    94  'to 94'

  22      24  SETUP_LOOP           94  'to 94'
          26  LOAD_GLOBAL              'auto_aiter'
          28  LOAD_FAST                'seq'
          30  CALL_FUNCTION_1       1  ''
          32  GET_AITER        
          34  LOAD_CONST               None
          36  YIELD_FROM       
          38  SETUP_EXCEPT         52  'to 52'
          40  GET_ANEXT        
          42  LOAD_CONST               None
          44  YIELD_FROM       
          46  STORE_FAST               'item'
          48  POP_BLOCK        
          50  JUMP_FORWARD         74  'to 74'
        52_0  COME_FROM_EXCEPT     38  '38'
          52  DUP_TOP          
          54  LOAD_GLOBAL              'StopAsyncIteration'
          56  COMPARE_OP               'exception-match'
          58  POP_JUMP_IF_FALSE    72  'to 72'
          60  POP_TOP          
          62  POP_TOP          
          64  POP_TOP          
          66  POP_EXCEPT       
          68  POP_BLOCK        
          70  JUMP_ABSOLUTE        94  'to 94'
          72  END_FINALLY      
        74_0  COME_FROM            50  '50'

  23      74  LOAD_FAST                'func'
          76  LOAD_FAST                'item'
          78  CALL_FUNCTION_1       1  ''
          80  POP_JUMP_IF_FALSE    38  'to 38'

  24      82  LOAD_FAST                'item'
          84  YIELD_VALUE      
          86  POP_TOP          
          88  JUMP_BACK            38  'to 38'
          90  POP_BLOCK        
        92_0  COME_FROM_LOOP       24  '24'
          92  JUMP_ABSOLUTE        94  'to 94'

Parse error at or near `COME_FROM_LOOP' instruction at offset 92_0


def dualfilter(normal_filter, async_filter):
    wrap_evalctx = False
    if getattr(normal_filter, 'environmentfilter', False):
        is_async = lambda args: args[0].is_async
        wrap_evalctx = False
    else:
        if not getattr(normal_filter, 'evalcontextfilter', False):
            if not getattr(normal_filter, 'contextfilter', False):
                wrap_evalctx = True
        is_async = lambda args: args[0].environment.is_async

    @wraps(normal_filter)
    def wrapper(*args, **kwargs):
        b = is_async(args)
        if wrap_evalctx:
            args = args[1:]
        if b:
            return async_filter(*args, **kwargs)
        else:
            return normal_filter(*args, **kwargs)

    if wrap_evalctx:
        wrapper.evalcontextfilter = True
    wrapper.asyncfiltervariant = True
    return wrapper


def asyncfiltervariant(original):

    def decorator(f):
        return dualfilteroriginalf

    return decorator


@asyncfiltervariant(filters.do_first)
def do_first(environment, seq):
    try:
        return await (auto_aiter(seq).__anext__())
    except StopAsyncIteration:
        return environment.undefined('No first item, sequence was empty.')


@asyncfiltervariant(filters.do_groupby)
def do_groupby(environment, value, attribute):
    expr = filters.make_attrgetterenvironmentattribute
    return await [filters._GroupTuplekeyawait (auto_to_seq(values)) for key, values in filters.groupby(sorted(await (auto_to_seq(value)),
      key=expr))expr]


@asyncfiltervariant(filters.do_join)
def do_join(eval_ctx, value, d='', attribute=None):
    return filters.do_joineval_ctxawait (auto_to_seq(value))dattribute


@asyncfiltervariant(filters.do_list)
def do_list(value):
    return await (auto_to_seq(value))


@asyncfiltervariant(filters.do_reject)
def do_reject(*args, **kwargs):
    return async_select_or_rejectargskwargs(lambda x: not x)False


@asyncfiltervariant(filters.do_rejectattr)
def do_rejectattr(*args, **kwargs):
    return async_select_or_rejectargskwargs(lambda x: not x)True


@asyncfiltervariant(filters.do_select)
def do_select(*args, **kwargs):
    return async_select_or_rejectargskwargs(lambda x: x)False


@asyncfiltervariant(filters.do_selectattr)
def do_selectattr(*args, **kwargs):
    return async_select_or_rejectargskwargs(lambda x: x)True


@asyncfiltervariant(filters.do_map)
def do_map--- This code section failed: ---

 109       0  LOAD_GLOBAL              'filters'
           2  LOAD_ATTR                'prepare_map'
           4  LOAD_FAST                'args'
           6  LOAD_FAST                'kwargs'
           8  CALL_FUNCTION_2       2  ''
          10  UNPACK_SEQUENCE_2     2  ''
          12  STORE_FAST               'seq'
          14  STORE_FAST               'func'

 110      16  LOAD_FAST                'seq'
          18  POP_JUMP_IF_FALSE    86  'to 86'

 111      20  SETUP_LOOP           86  'to 86'
          22  LOAD_GLOBAL              'auto_aiter'
          24  LOAD_FAST                'seq'
          26  CALL_FUNCTION_1       1  ''
          28  GET_AITER        
          30  LOAD_CONST               None
          32  YIELD_FROM       
          34  SETUP_EXCEPT         48  'to 48'
          36  GET_ANEXT        
          38  LOAD_CONST               None
          40  YIELD_FROM       
          42  STORE_FAST               'item'
          44  POP_BLOCK        
          46  JUMP_FORWARD         70  'to 70'
        48_0  COME_FROM_EXCEPT     34  '34'
          48  DUP_TOP          
          50  LOAD_GLOBAL              'StopAsyncIteration'
          52  COMPARE_OP               'exception-match'
          54  POP_JUMP_IF_FALSE    68  'to 68'
          56  POP_TOP          
          58  POP_TOP          
          60  POP_TOP          
          62  POP_EXCEPT       
          64  POP_BLOCK        
          66  JUMP_ABSOLUTE        86  'to 86'
          68  END_FINALLY      
        70_0  COME_FROM            46  '46'

 112      70  LOAD_FAST                'func'
          72  LOAD_FAST                'item'
          74  CALL_FUNCTION_1       1  ''
          76  YIELD_VALUE      
          78  POP_TOP          
          80  JUMP_BACK            34  'to 34'
          82  POP_BLOCK        
        84_0  COME_FROM_LOOP       20  '20'
          84  JUMP_ABSOLUTE        86  'to 86'

Parse error at or near `COME_FROM_LOOP' instruction at offset 84_0


@asyncfiltervariant(filters.do_sum)
def do_sum--- This code section failed: ---

 117       0  LOAD_FAST                'start'
           2  STORE_FAST               'rv'

 118       4  LOAD_FAST                'attribute'
           6  LOAD_CONST               None
           8  COMPARE_OP               'is-not'
          10  POP_JUMP_IF_FALSE    26  'to 26'

 119      12  LOAD_GLOBAL              'filters'
          14  LOAD_ATTR                'make_attrgetter'
          16  LOAD_FAST                'environment'
          18  LOAD_FAST                'attribute'
          20  CALL_FUNCTION_2       2  ''
          22  STORE_FAST               'func'
          24  JUMP_FORWARD         34  'to 34'
          26  ELSE                     '34'

 121      26  LOAD_LAMBDA              '<code_object <lambda>>'
          28  LOAD_CONST               'do_sum.<locals>.<lambda>'
          30  MAKE_FUNCTION_0          ''
          32  STORE_FAST               'func'
        34_0  COME_FROM            24  '24'

 122      34  SETUP_LOOP          102  'to 102'
          36  LOAD_GLOBAL              'auto_aiter'
          38  LOAD_FAST                'iterable'
          40  CALL_FUNCTION_1       1  ''
          42  GET_AITER        
          44  LOAD_CONST               None
          46  YIELD_FROM       
          48  SETUP_EXCEPT         62  'to 62'
          50  GET_ANEXT        
          52  LOAD_CONST               None
          54  YIELD_FROM       
          56  STORE_FAST               'item'
          58  POP_BLOCK        
          60  JUMP_FORWARD         84  'to 84'
        62_0  COME_FROM_EXCEPT     48  '48'
          62  DUP_TOP          
          64  LOAD_GLOBAL              'StopAsyncIteration'
          66  COMPARE_OP               'exception-match'
          68  POP_JUMP_IF_FALSE    82  'to 82'
          70  POP_TOP          
          72  POP_TOP          
          74  POP_TOP          
          76  POP_EXCEPT       
          78  POP_BLOCK        
          80  JUMP_ABSOLUTE       102  'to 102'
          82  END_FINALLY      
        84_0  COME_FROM            60  '60'

 123      84  LOAD_FAST                'rv'
          86  LOAD_FAST                'func'
          88  LOAD_FAST                'item'
          90  CALL_FUNCTION_1       1  ''
          92  INPLACE_ADD      
          94  STORE_FAST               'rv'
          96  JUMP_BACK            48  'to 48'
          98  POP_BLOCK        
         100  JUMP_ABSOLUTE       102  'to 102'
       102_0  COME_FROM_LOOP       34  '34'

 124     102  LOAD_FAST                'rv'
         104  RETURN_VALUE     
          -1  RETURN_LAST      

Parse error at or near `JUMP_ABSOLUTE' instruction at offset 100


@asyncfiltervariant(filters.do_slice)
def do_slice(value, slices, fill_with=None):
    return filters.do_slice(await (auto_to_seq(value)), slices, fill_with)


ASYNC_FILTERS = {'first':do_first, 
 'groupby':do_groupby, 
 'join':do_join, 
 'list':do_list, 
 'reject':do_reject, 
 'rejectattr':do_rejectattr, 
 'map':do_map, 
 'select':do_select, 
 'selectattr':do_selectattr, 
 'sum':do_sum, 
 'slice':do_slice}